package day01;

public class first1 {


	public class Day2 {

		@Test
		public void test1() {
			boolean bool1 = true;
			boolean bool2 = false;
			System.out.println(bool1);
			System.out.println(bool2);
		}

		@Test
		public void test2() {
			// 比较运算符：> < >= <= != 结果就是boolean
			int num1 = 90;
			int num2 = 80;
			boolean b = (num1 >= num2);
			System.out.println(b); // true
		}

		a

//		>=90   <=100   优秀 
//		>=80    <90       良好
//		>=70    <80       一般
//		>=60    <70      及格
//		<60                    不及格
		@Test
		public void test5() {
			int score = 78;
			if (score >= 90 && score <= 100) {
				System.out.println("优秀");
			} else if (score >= 80 && score < 90) {
				System.out.println("良好");
			} else if (score >= 70 && score < 80) {
				System.out.println("一般");
			} else if (score >= 60 && score < 70) {
				System.out.println("及格");
			} else {
				System.out.println("不及格");
			}
		}

		// Duplicate method test5() in type Day2
		@Test
		public void test6() {
			int year = 2000;
			if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0)) {
				System.out.println("是闰年");
			} else {
				System.out.println("不是闰年");
			}

			// if (() || ()) {}
			if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
				System.out.println("是闰年");
			} else {
				System.out.println("不是闰年");
			}

		}

		@Test
		public void test8() {
			// Scanner可以从控制台读取用户的输入
			Scanner scanner = new Scanner(System.in);
			// 用户输入完之后按回车会将输入的结果赋值给year
			int year = scanner.nextInt();
			if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
				System.out.println(year + "是闰年");
			} else {
				System.out.println(year + "不是闰年");
			}
		}

		@Test
		public void test13() {
			int num = 2009;
			if (num % 100 != 0 && num % 4 == 0) {
			}
			if (num % 100 != 0) {
				if (num % 4 == 0) {
					System.out.println(num + "是闰年");
				} else {
					System.out.println(num + "不是闰年");
				}
			} else if (num % 400 == 0) {
				System.out.println(num + "是闰年");
			} else {
				System.out.println(num + "不是闰年");
			}
		}
		
		@Test
		public void test44() {
			int count = 1;
			while (count <= 5) {
				System.out.println(count);
				System.out.println("HelloWorld!");
				count = count + 1;
			}
			
			while (true) {
				int num = 1;
			}
			// Unreachable code
			// System.out.println("Day2.test44()");
		}
		
		// 1+2+3+4+....+100
		@Test
		public void test55() {
			int i = 1;
			int sum = 0;
			while (i <= 100) {
				System.out.println(i);
				sum = sum + i;
				i = i + 1;
			}
			System.out.println("sum: " + sum);
		}
		
		@Test
		public void test553() {
			for (int i = 1; i <= 5; i = i + 1) {
				System.out.println("HelloWorld");
			}
		}
		
		@Test
		public void test552() {
			int sum = 0;
			for (int i = 1; i <= 100; i++) {
				System.out.println(i);
				sum = sum + i;
			}
			System.out.println(sum);
		}
		
		// 计算1-100以内7的倍数的个数
		@Test
		public void test666() {
			int count = 0;
			for (int i = 1; i <= 100; i++) {
				if (i % 7 == 0) {
					System.out.println(i);
					count = count + 1;
				}
			}
			System.out.println(count);
		}
		
		
	}

}
